package xyz.ddlnt.servicemgclient.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.ExamQuestionDTO;
import xyz.ddlnt.model.dto.PublishStatus;
import xyz.ddlnt.model.vo.ExamQuestionInfoVO;
import xyz.ddlnt.model.vo.ExamQuestionVO;
import xyz.ddlnt.servicemgclient.client.fallback.ExamQuestionFallbackFactory;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/3 23:44
 */
//@FeignClient(name = "service-mg", url = "http://yixuewang-service-mg:9016", path = "/exam_question", fallbackFactory = ExamQuestionFallbackFactory.class)
//@FeignClient(name = "service-mg", url = "http://localhost:9006", path = "/exam_question", fallbackFactory = ExamQuestionFallbackFactory.class)
@FeignClient(value = "service-mg", path = "/exam_question", fallbackFactory = ExamQuestionFallbackFactory.class)
public interface ExamQuestionFeignClient {
    /**
     * 添加试题
     * @param examQuestionDTO
     * @return
     */
    @PostMapping("/addExamQuestion")
    Result<ExamQuestionVO> addExamQuestion(@RequestBody ExamQuestionDTO examQuestionDTO);

    /**
     * 删除试题
     * @param id
     * @return
     */
    @DeleteMapping("/deleteExamQuestion")
    Result<Boolean> deleteExamQuestion(@RequestParam Long id);

    /**
     * 修改试题
     * @param examQuestionDTO
     * @return
     */
    @PutMapping("/updateExamQuestion")
    Result<ExamQuestionVO> updateExamQuestion(@RequestBody ExamQuestionDTO examQuestionDTO);

    /**
     * 修改试题发布状态
     * @param publishStatus
     * @return
     */
    @PutMapping("/updatePublishStatus")
    Result<Boolean> updatePublishStatus(@RequestBody PublishStatus publishStatus);

    /**
     * 根据试题id查询试题信息
     * @return
     */
    @GetMapping("/getExamQuestionById")
    Result<ExamQuestionInfoVO> getExamQuestionById(@RequestParam Long id);

    /**
     * 查询所有试题信息
     * @return
     */
    @GetMapping("/getExamQuestions")
    Result<List<ExamQuestionVO>> getExamQuestions();
}
